<!DOCTYPE html>
<html>
<body>
<script>
function init()
{
    var script = document.createElement("script");
    script.src = "does-not-exist.js";
    script.onerror = function () { window.top.done(); };
    document.body.appendChild(script);
    // otherDoc's contextDocument is document.
    var otherDoc = document.implementation.createDocument("", "a", null);
    var divElement = otherDoc.createElement("div");
    divElement.appendChild(script);
    var iframe = document.createElement("iframe");
    iframe.appendChild(script);
}

init();
</script>
</body>
</html>
